------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  /Users/kcb38/Library/CloudStorage/Box-Box/Relation creation/JOPreplication/Fi
> g4_JOPreplication.log
  log type:  text
 opened on:  21 Aug 2023, 15:56:17

. do "/var/folders/_k/kq9jm16n2j56f62vqdthwl3x___x66/T//SD29851.000000"

. 
. clear

. 
. *cd "[directory information here]"
. cd "/Users/kcb38/Library/CloudStorage/Box-Box/Relation creation/JOPreplication/"
/Users/kcb38/Library/CloudStorage/Box-Box/Relation creation/JOPreplication

. 
. *First establish appropriate scale of change, remembering that SAOM models center intera
> cted variales at their means
. insheet using "relation_nodal.csv", clear
(20 vars, 4,684 obs)

. sum support_mi, detail

                         support_mi
-------------------------------------------------------------
      Percentiles      Smallest
 1%     .0047387              0
 5%       .02485              0
10%     .0764932              0       Obs               4,684
25%     .2144604              0       Sum of wgt.       4,684

50%            1                      Mean           .8222485
                        Largest       Std. dev.      .5969763
75%     1.291205       2.532269
90%     1.571749       2.535378       Variance       .3563807
95%     1.692464       2.591655       Skewness       .1314802
99%     2.121878       2.651886       Kurtosis        1.79414

. sum support_ipcloseness, detail

                     support_ipcloseness
-------------------------------------------------------------
      Percentiles      Smallest
 1%            0              0
 5%     .3147551              0
10%     .3732595              0       Obs               4,684
25%     .5128938              0       Sum of wgt.       4,684

50%     .6698986                      Mean           .6252167
                        Largest       Std. dev.      .1712834
75%     .7518386       .9963563
90%     .8036968         .99639       Variance        .029338
95%      .837517       .9979303       Skewness      -.8951703
99%      .901746       .9983473       Kurtosis       3.716949

. 
. clear

. *Now create graphs using the standard deviations and coefficient values from Model 1 of 
> the SAOM estimation
. 
. *SD for support_mi = 0.60
. *SD for support_ipcloseness = 0.17
. *Coef on alter support_mi for threat = .26
. *Coef on support_mi for intra = .18
. *Coef on alter support_ipcloseness for threat = -0.61
. *Coef on support_ipcloseness for intra = -.79
. *Coef on interaction for threat = -.69
. *Coef on interaction for intra = -1.97
. 
. set obs 11
Number of observations (_N) was 0, now 11.

. gen d_support_mi=-.2+(.2*_n)

. gen threat_mean_IP=exp(0.60*d_support_mi*0.26)

. gen intra_mean_IP=exp(0.60*d_support_mi*0.18)

. gen threat_hi_IP=exp((0.60*d_support_mi*0.26)+(2*0.17*0.60*d_support_mi*-0.69) + (2*.17*
> -0.61))

. gen intra_hi_IP=exp((0.60*d_support_mi*0.18)+(2*0.17*0.60*d_support_mi*-1.97) + (2*.17*-
> 0.79)) 

. gen threat_lo_IP=exp((0.60*d_support_mi*0.26)+(2*-0.17*0.60*d_support_mi*-0.69) + (2*-.1
> 7*-0.61))

. gen intra_lo_IP=exp((0.60*d_support_mi*0.18)+(2*-0.17*0.60*d_support_mi*-1.97) + (2*-.17
> *-0.79))

. 
. twoway (line threat_lo_IP d_support_mi, sort lcolor(dknavy) lwidth(thick) lpattern(short
> dash)) (line threat_mean_IP d_support_mi, sort lcolor(teal) lwidth(thick) lpattern(solid
> )) (line threat_hi_IP d_support_mi, sort lcolor(lavender) lwidth(thick) lpattern(dash)),
>  ytitle(Interstate Threat Odds Ratio) ytitle(, margin(medium)) ylabel(.5(.5)3.5) xtitle(
> Change in j's Support Group Military Spending (sd)) xscale(range(0 2)) xlabel(0(.2)2) le
> gend(on order(1 "Low Supp. Grp IP Close." 2 "Mean Supp. Grp IP Close." 3 "High Supp. Grp
>  IP Close.")) scheme(s1mono)

. *Create a "Figures" subfolder and then save your files
. graph save Figures/substance_threat_paper.gph, replace
file Figures/substance_threat_paper.gph saved

. graph export Figures/substance_threat_paper.pdf, replace
file /Users/kcb38/Library/CloudStorage/Box-Box/Relation
    creation/JOPreplication/Figures/substance_threat_paper.pdf saved as PDF format

. 
. twoway (line intra_lo_IP d_support_mi, sort lcolor(dknavy) lwidth(thick) lpattern(shortd
> ash)) (line intra_mean_IP d_support_mi, sort lcolor(teal) lwidth(thick) lpattern(solid))
>  (line intra_hi_IP d_support_mi, sort lcolor(lavender) lwidth(thick) lpattern(dash)), yt
> itle(Intrastate Conflict Escalation Odds Ratio) ytitle(, margin(medium)) ylabel(.5(.5)3.
> 5) xtitle(Change in i's Support Group Military Spending (sd)) xscale(range(0 2)) xlabel(
> 0(.2)2) legend(on order(1 "Low Supp. Grp IP Close." 2 "Mean Supp. Grp IP Close." 3 "High
>  Supp. Grp IP Close.")) scheme(s1mono)

. graph save Figures/substance_intra_paper.gph, replace
file Figures/substance_intra_paper.gph saved

. graph export Figures/substance_intra_paper.pdf, replace
file /Users/kcb38/Library/CloudStorage/Box-Box/Relation
    creation/JOPreplication/Figures/substance_intra_paper.pdf saved as PDF format

. 
end of do-file

. log close
      name:  <unnamed>
       log:  /Users/kcb38/Library/CloudStorage/Box-Box/Relation creation/JOPreplication/Fi
> g4_JOPreplication.log
  log type:  text
 closed on:  21 Aug 2023, 15:56:48
------------------------------------------------------------------------------------------
